/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package papacharly.encheres.log;

/**
 *
 * @author user01
 */
public class Logger {
    private final String prefix;

    public Logger(final String prefix) {
        this.prefix = prefix;
    }

    public static Logger getLogger(final String message){
        return new Logger(message);
    }

    public void info(final String message) {
        System.out.println("INFO\t[" + prefix + "] " + message);
    }

    public void info(final String message, final Throwable throwable) {
        System.out.println("INFO\t[" + prefix + "] " + message);
        throwable.printStackTrace(System.out);
    }

    public void debug(final String message) {
        System.out.println("DEBUG\t[" + prefix + "] " + message);
    }

    public void debug(final String message, final Throwable throwable) {
       System.out.println("DEBUG\t[" + prefix + "] " + message);
       throwable.printStackTrace(System.out);
    }

    public void warn(final String message) {
         System.out.println("WARN\t[" + prefix + "] " + message);
    }

    public void warn(final String message, final Throwable throwable) {
        System.err.println("WARN\t[" + prefix + "] " + message);
        throwable.printStackTrace(System.err);
    }

    public void error(final String message) {
        System.err.println("ERROR\t[" + prefix + "] " + message);
    }

    public void error(final String message, final Throwable throwable) {
        System.err.println("ERROR\t[" + prefix + "] " + message);
        throwable.printStackTrace(System.err);
    }
}
